<script setup>

import { ref, defineExpose } from 'vue'
import ContextMenu from '@imengyu/vue3-context-menu'
const color_themes = [
    {
        to: '#E8521C',
        from: '#CD0C2F',
        color: "white"
    },
    {
        to: '#F76A38',
        from: '#DB2E26',
        color: "white"
    },
    {
        to: '#F87D0B',
        from: '#EA4F30',
        color: "white"
    },
    {
        to: '#FEAB04',
        from: '#F1671C',
        color: "white"
    },
    {
        to: '#FFC700',
        from: '#F68014',
        color: "white"
    },
    {
        to: '#FFE435',
        from: '#FAA91B',
        color: "white"
    },
    {
        to: '#EAFF00',
        from: '#FFE132',
        color: "black"
    },
    {
        to: '#BFFF00',
        from: '#EBFC03',
        color: "black"
    },
    {
        to: '#7DF415',
        from: '#C3FF01',
        color: "black"
    },
    {
        to: '#2DDF0E',
        from: '#9BF513',
        color: "black"
    },
    {
        to: '#0DCB62',
        from: '#7EE567',
        color: "black"
    },
    {
        to: '#0FB888',
        from: '#10CE5C',
        color: "white"
    },
    {
        to: '#10B5CE',
        from: '#0FB888',
        color: "white"
    },
    {
        to: '#1180D0',
        from: '#10C8CE',
        color: "white"
    },
    {
        to: '#076AE2',
        from: '#1198CF',
        color: "white"
    },
    {
        to: '#5235F1',
        from: '#197CF6',
        color: "white"
    }
]
let show_details = ref(false);
defineExpose({
    show_details
})
let columns = ref([]);

let thread_columns = ref([]);
// 这里需要结果送进来，结构如下。
let result_data = ref([
    // 测试打开
    // { "文件名": "main1.scpp(17~20)", "函数名": "testA", "执行次数": 1, "拍数": 6446, "指令缓存MISS次数": 0, "GLOBAL内存访问次数": 1, "index": "1" }, { "文件名": "main1.scpp(22~24)", "函数名": "testA", "执行次数": 1, "拍数": 1, "指令缓存MISS次数": 0, "GLOBAL内存访问次数": 0, "index": "3" }, { "文件名": "main1.scpp(7~7)", "函数名": "sum_funcA", "执行次数": 10, "拍数": 8392, "指令缓存MISS次数": 0, "GLOBAL内存访问次数": 0, "index": "0" }, { "文件名": "main2.scpp(16~19)", "函数名": "testB", "执行次数": 1, "拍数": 6014, "指令缓存MISS次数": 0, "GLOBAL内存访问次数": 2, "index": "2" }, { "文件名": "main2.scpp(21~23)", "函数名": "testB", "执行次数": 1, "拍数": 1, "指令缓存MISS次数": 0, "GLOBAL内存访问次数": 0, "index": "4" }
]);

let all_result_data = ref();

function test_demo()
{
    result_data.value = [{ "文件名": "main1.scpp(17~20)", "函数名": "testA", "执行次数": 1, "拍数": 6446, "指令缓存MISS次数": 0, "GLOBAL内存访问次数": 1, "index": "1" }, { "文件名": "main1.scpp(22~24)", "函数名": "testA", "执行次数": 1, "拍数": 1, "指令缓存MISS次数": 0, "GLOBAL内存访问次数": 0, "index": "3" }, { "文件名": "main1.scpp(7~7)", "函数名": "sum_funcA", "执行次数": 10, "拍数": 8392, "指令缓存MISS次数": 0, "GLOBAL内存访问次数": 0, "index": "0" }, { "文件名": "main2.scpp(16~19)", "函数名": "testB", "执行次数": 1, "拍数": 6014, "指令缓存MISS次数": 0, "GLOBAL内存访问次数": 2, "index": "2" }, { "文件名": "main2.scpp(21~23)", "函数名": "testB", "执行次数": 1, "拍数": 1, "指令缓存MISS次数": 0, "GLOBAL内存访问次数": 0, "index": "4" }];
    all_result_data.value = {
    "main1.scpp(17~20)": [
        {
            "文件名": "main1.scpp(17~20)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "0",
            "拍数": 6447,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 1,
            "index": "0"
        },
        {
            "文件名": "main1.scpp(17~20)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "1",
            "拍数": 6428,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 1,
            "index": "9"
        },
        {
            "文件名": "main1.scpp(17~20)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "2",
            "拍数": 6447,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 1,
            "index": "1"
        },
        {
            "文件名": "main1.scpp(17~20)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "3",
            "拍数": 6428,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 1,
            "index": "10"
        },
        {
            "文件名": "main1.scpp(17~20)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "4",
            "拍数": 6428,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 1,
            "index": "11"
        },
        {
            "文件名": "main1.scpp(17~20)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "5",
            "拍数": 6428,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 1,
            "index": "12"
        },
        {
            "文件名": "main1.scpp(17~20)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "6",
            "拍数": 6427,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 1,
            "index": "21"
        },
        {
            "文件名": "main1.scpp(17~20)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "7",
            "拍数": 6428,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 1,
            "index": "13"
        },
        {
            "文件名": "main1.scpp(17~20)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "8",
            "拍数": 6428,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 1,
            "index": "14"
        },
        {
            "文件名": "main1.scpp(17~20)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "9",
            "拍数": 6425,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 1,
            "index": "29"
        },
        {
            "文件名": "main1.scpp(17~20)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "10",
            "拍数": 6441,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 1,
            "index": "2"
        },
        {
            "文件名": "main1.scpp(17~20)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "11",
            "拍数": 6438,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 1,
            "index": "3"
        },
        {
            "文件名": "main1.scpp(17~20)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "12",
            "拍数": 6427,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 1,
            "index": "22"
        },
        {
            "文件名": "main1.scpp(17~20)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "13",
            "拍数": 6428,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 1,
            "index": "15"
        },
        {
            "文件名": "main1.scpp(17~20)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "14",
            "拍数": 6427,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 1,
            "index": "23"
        },
        {
            "文件名": "main1.scpp(17~20)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "15",
            "拍数": 6425,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 1,
            "index": "30"
        },
        {
            "文件名": "main1.scpp(17~20)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "16",
            "拍数": 6427,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 1,
            "index": "24"
        },
        {
            "文件名": "main1.scpp(17~20)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "17",
            "拍数": 6431,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 1,
            "index": "5"
        },
        {
            "文件名": "main1.scpp(17~20)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "18",
            "拍数": 6434,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 1,
            "index": "4"
        },
        {
            "文件名": "main1.scpp(17~20)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "19",
            "拍数": 6426,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 1,
            "index": "27"
        },
        {
            "文件名": "main1.scpp(17~20)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "20",
            "拍数": 6422,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 1,
            "index": "31"
        },
        {
            "文件名": "main1.scpp(17~20)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "21",
            "拍数": 6429,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 1,
            "index": "7"
        },
        {
            "文件名": "main1.scpp(17~20)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "22",
            "拍数": 6429,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 1,
            "index": "8"
        },
        {
            "文件名": "main1.scpp(17~20)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "23",
            "拍数": 6428,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 1,
            "index": "16"
        },
        {
            "文件名": "main1.scpp(17~20)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "24",
            "拍数": 6427,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 1,
            "index": "25"
        },
        {
            "文件名": "main1.scpp(17~20)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "25",
            "拍数": 6430,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 1,
            "index": "6"
        },
        {
            "文件名": "main1.scpp(17~20)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "26",
            "拍数": 6426,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 1,
            "index": "28"
        },
        {
            "文件名": "main1.scpp(17~20)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "27",
            "拍数": 6428,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 1,
            "index": "17"
        },
        {
            "文件名": "main1.scpp(17~20)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "28",
            "拍数": 6428,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 1,
            "index": "18"
        },
        {
            "文件名": "main1.scpp(17~20)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "29",
            "拍数": 6428,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 1,
            "index": "19"
        },
        {
            "文件名": "main1.scpp(17~20)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "30",
            "拍数": 6427,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 1,
            "index": "26"
        },
        {
            "文件名": "main1.scpp(17~20)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "31",
            "拍数": 6428,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 1,
            "index": "20"
        }
    ],
    "main1.scpp(22~24)": [
        {
            "文件名": "main1.scpp(22~24)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "0",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "0"
        },
        {
            "文件名": "main1.scpp(22~24)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "1",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "1"
        },
        {
            "文件名": "main1.scpp(22~24)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "2",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "2"
        },
        {
            "文件名": "main1.scpp(22~24)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "3",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "3"
        },
        {
            "文件名": "main1.scpp(22~24)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "4",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "4"
        },
        {
            "文件名": "main1.scpp(22~24)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "5",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "5"
        },
        {
            "文件名": "main1.scpp(22~24)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "6",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "6"
        },
        {
            "文件名": "main1.scpp(22~24)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "7",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "7"
        },
        {
            "文件名": "main1.scpp(22~24)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "8",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "8"
        },
        {
            "文件名": "main1.scpp(22~24)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "9",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "9"
        },
        {
            "文件名": "main1.scpp(22~24)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "10",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "10"
        },
        {
            "文件名": "main1.scpp(22~24)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "11",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "11"
        },
        {
            "文件名": "main1.scpp(22~24)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "12",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "12"
        },
        {
            "文件名": "main1.scpp(22~24)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "13",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "13"
        },
        {
            "文件名": "main1.scpp(22~24)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "14",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "14"
        },
        {
            "文件名": "main1.scpp(22~24)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "15",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "15"
        },
        {
            "文件名": "main1.scpp(22~24)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "16",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "16"
        },
        {
            "文件名": "main1.scpp(22~24)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "17",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "17"
        },
        {
            "文件名": "main1.scpp(22~24)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "18",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "18"
        },
        {
            "文件名": "main1.scpp(22~24)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "19",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "19"
        },
        {
            "文件名": "main1.scpp(22~24)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "20",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "20"
        },
        {
            "文件名": "main1.scpp(22~24)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "21",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "21"
        },
        {
            "文件名": "main1.scpp(22~24)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "22",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "22"
        },
        {
            "文件名": "main1.scpp(22~24)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "23",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "23"
        },
        {
            "文件名": "main1.scpp(22~24)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "24",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "24"
        },
        {
            "文件名": "main1.scpp(22~24)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "25",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "25"
        },
        {
            "文件名": "main1.scpp(22~24)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "26",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "26"
        },
        {
            "文件名": "main1.scpp(22~24)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "27",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "27"
        },
        {
            "文件名": "main1.scpp(22~24)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "28",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "28"
        },
        {
            "文件名": "main1.scpp(22~24)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "29",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "29"
        },
        {
            "文件名": "main1.scpp(22~24)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "30",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "30"
        },
        {
            "文件名": "main1.scpp(22~24)",
            "函数名": "testA",
            "执行次数": 1,
            "线程号": "31",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "31"
        }
    ],
    "main1.scpp(7~7)": [
        {
            "文件名": "main1.scpp(7~7)",
            "函数名": "sum_funcA",
            "执行次数": 10,
            "线程号": "0",
            "拍数": 519,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "26"
        },
        {
            "文件名": "main1.scpp(7~7)",
            "函数名": "sum_funcA",
            "执行次数": 10,
            "线程号": "1",
            "拍数": 521,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "24"
        },
        {
            "文件名": "main1.scpp(7~7)",
            "函数名": "sum_funcA",
            "执行次数": 10,
            "线程号": "2",
            "拍数": 520,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "25"
        },
        {
            "文件名": "main1.scpp(7~7)",
            "函数名": "sum_funcA",
            "执行次数": 10,
            "线程号": "3",
            "拍数": 519,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "27"
        },
        {
            "文件名": "main1.scpp(7~7)",
            "函数名": "sum_funcA",
            "执行次数": 10,
            "线程号": "4",
            "拍数": 476,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "31"
        },
        {
            "文件名": "main1.scpp(7~7)",
            "函数名": "sum_funcA",
            "执行次数": 10,
            "线程号": "5",
            "拍数": 537,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "11"
        },
        {
            "文件名": "main1.scpp(7~7)",
            "函数名": "sum_funcA",
            "执行次数": 10,
            "线程号": "6",
            "拍数": 528,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "19"
        },
        {
            "文件名": "main1.scpp(7~7)",
            "函数名": "sum_funcA",
            "执行次数": 10,
            "线程号": "7",
            "拍数": 519,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "28"
        },
        {
            "文件名": "main1.scpp(7~7)",
            "函数名": "sum_funcA",
            "执行次数": 10,
            "线程号": "8",
            "拍数": 557,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "5"
        },
        {
            "文件名": "main1.scpp(7~7)",
            "函数名": "sum_funcA",
            "执行次数": 10,
            "线程号": "9",
            "拍数": 529,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "17"
        },
        {
            "文件名": "main1.scpp(7~7)",
            "函数名": "sum_funcA",
            "执行次数": 10,
            "线程号": "10",
            "拍数": 528,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "20"
        },
        {
            "文件名": "main1.scpp(7~7)",
            "函数名": "sum_funcA",
            "执行次数": 10,
            "线程号": "11",
            "拍数": 485,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "30"
        },
        {
            "文件名": "main1.scpp(7~7)",
            "函数名": "sum_funcA",
            "执行次数": 10,
            "线程号": "12",
            "拍数": 528,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "21"
        },
        {
            "文件名": "main1.scpp(7~7)",
            "函数名": "sum_funcA",
            "执行次数": 10,
            "线程号": "13",
            "拍数": 547,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "7"
        },
        {
            "文件名": "main1.scpp(7~7)",
            "函数名": "sum_funcA",
            "执行次数": 10,
            "线程号": "14",
            "拍数": 530,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "16"
        },
        {
            "文件名": "main1.scpp(7~7)",
            "函数名": "sum_funcA",
            "执行次数": 10,
            "线程号": "15",
            "拍数": 528,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "22"
        },
        {
            "文件名": "main1.scpp(7~7)",
            "函数名": "sum_funcA",
            "执行次数": 10,
            "线程号": "16",
            "拍数": 492,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "29"
        },
        {
            "文件名": "main1.scpp(7~7)",
            "函数名": "sum_funcA",
            "执行次数": 10,
            "线程号": "17",
            "拍数": 534,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "13"
        },
        {
            "文件名": "main1.scpp(7~7)",
            "函数名": "sum_funcA",
            "执行次数": 10,
            "线程号": "18",
            "拍数": 547,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "8"
        },
        {
            "文件名": "main1.scpp(7~7)",
            "函数名": "sum_funcA",
            "执行次数": 10,
            "线程号": "19",
            "拍数": 566,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "4"
        },
        {
            "文件名": "main1.scpp(7~7)",
            "函数名": "sum_funcA",
            "执行次数": 10,
            "线程号": "20",
            "拍数": 537,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "12"
        },
        {
            "文件名": "main1.scpp(7~7)",
            "函数名": "sum_funcA",
            "执行次数": 10,
            "线程号": "21",
            "拍数": 524,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "23"
        },
        {
            "文件名": "main1.scpp(7~7)",
            "函数名": "sum_funcA",
            "执行次数": 10,
            "线程号": "22",
            "拍数": 544,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "9"
        },
        {
            "文件名": "main1.scpp(7~7)",
            "函数名": "sum_funcA",
            "执行次数": 10,
            "线程号": "23",
            "拍数": 529,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "18"
        },
        {
            "文件名": "main1.scpp(7~7)",
            "函数名": "sum_funcA",
            "执行次数": 10,
            "线程号": "24",
            "拍数": 1244,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "0"
        },
        {
            "文件名": "main1.scpp(7~7)",
            "函数名": "sum_funcA",
            "执行次数": 10,
            "线程号": "25",
            "拍数": 876,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "2"
        },
        {
            "文件名": "main1.scpp(7~7)",
            "函数名": "sum_funcA",
            "执行次数": 10,
            "线程号": "26",
            "拍数": 557,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "6"
        },
        {
            "文件名": "main1.scpp(7~7)",
            "函数名": "sum_funcA",
            "执行次数": 10,
            "线程号": "27",
            "拍数": 744,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "3"
        },
        {
            "文件名": "main1.scpp(7~7)",
            "函数名": "sum_funcA",
            "执行次数": 10,
            "线程号": "28",
            "拍数": 532,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "14"
        },
        {
            "文件名": "main1.scpp(7~7)",
            "函数名": "sum_funcA",
            "执行次数": 10,
            "线程号": "29",
            "拍数": 1171,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "1"
        },
        {
            "文件名": "main1.scpp(7~7)",
            "函数名": "sum_funcA",
            "执行次数": 10,
            "线程号": "30",
            "拍数": 544,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "10"
        },
        {
            "文件名": "main1.scpp(7~7)",
            "函数名": "sum_funcA",
            "执行次数": 10,
            "线程号": "31",
            "拍数": 532,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "15"
        }
    ],
    "main2.scpp(16~19)": [
        {
            "文件名": "main2.scpp(16~19)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "0",
            "拍数": 6014,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 2,
            "index": "0"
        },
        {
            "文件名": "main2.scpp(16~19)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "1",
            "拍数": 6014,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 2,
            "index": "1"
        },
        {
            "文件名": "main2.scpp(16~19)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "2",
            "拍数": 6014,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 2,
            "index": "2"
        },
        {
            "文件名": "main2.scpp(16~19)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "3",
            "拍数": 6014,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 2,
            "index": "3"
        },
        {
            "文件名": "main2.scpp(16~19)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "4",
            "拍数": 6014,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 2,
            "index": "4"
        },
        {
            "文件名": "main2.scpp(16~19)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "5",
            "拍数": 6014,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 2,
            "index": "5"
        },
        {
            "文件名": "main2.scpp(16~19)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "6",
            "拍数": 6014,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 2,
            "index": "6"
        },
        {
            "文件名": "main2.scpp(16~19)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "7",
            "拍数": 6014,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 2,
            "index": "7"
        },
        {
            "文件名": "main2.scpp(16~19)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "8",
            "拍数": 6014,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 2,
            "index": "8"
        },
        {
            "文件名": "main2.scpp(16~19)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "9",
            "拍数": 6014,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 2,
            "index": "9"
        },
        {
            "文件名": "main2.scpp(16~19)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "10",
            "拍数": 6014,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 2,
            "index": "10"
        },
        {
            "文件名": "main2.scpp(16~19)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "11",
            "拍数": 6014,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 2,
            "index": "11"
        },
        {
            "文件名": "main2.scpp(16~19)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "12",
            "拍数": 6014,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 2,
            "index": "12"
        },
        {
            "文件名": "main2.scpp(16~19)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "13",
            "拍数": 6014,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 2,
            "index": "13"
        },
        {
            "文件名": "main2.scpp(16~19)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "14",
            "拍数": 6014,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 2,
            "index": "14"
        },
        {
            "文件名": "main2.scpp(16~19)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "15",
            "拍数": 6014,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 2,
            "index": "15"
        },
        {
            "文件名": "main2.scpp(16~19)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "16",
            "拍数": 6014,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 2,
            "index": "16"
        },
        {
            "文件名": "main2.scpp(16~19)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "17",
            "拍数": 6014,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 2,
            "index": "17"
        },
        {
            "文件名": "main2.scpp(16~19)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "18",
            "拍数": 6014,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 2,
            "index": "18"
        },
        {
            "文件名": "main2.scpp(16~19)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "19",
            "拍数": 6014,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 2,
            "index": "19"
        },
        {
            "文件名": "main2.scpp(16~19)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "20",
            "拍数": 6014,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 2,
            "index": "20"
        },
        {
            "文件名": "main2.scpp(16~19)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "21",
            "拍数": 6014,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 2,
            "index": "21"
        },
        {
            "文件名": "main2.scpp(16~19)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "22",
            "拍数": 6014,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 2,
            "index": "22"
        },
        {
            "文件名": "main2.scpp(16~19)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "23",
            "拍数": 6014,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 2,
            "index": "23"
        },
        {
            "文件名": "main2.scpp(16~19)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "24",
            "拍数": 6014,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 2,
            "index": "24"
        },
        {
            "文件名": "main2.scpp(16~19)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "25",
            "拍数": 6014,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 2,
            "index": "25"
        },
        {
            "文件名": "main2.scpp(16~19)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "26",
            "拍数": 6014,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 2,
            "index": "26"
        },
        {
            "文件名": "main2.scpp(16~19)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "27",
            "拍数": 6014,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 2,
            "index": "27"
        },
        {
            "文件名": "main2.scpp(16~19)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "28",
            "拍数": 6014,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 2,
            "index": "28"
        },
        {
            "文件名": "main2.scpp(16~19)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "29",
            "拍数": 6014,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 2,
            "index": "29"
        },
        {
            "文件名": "main2.scpp(16~19)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "30",
            "拍数": 6014,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 2,
            "index": "30"
        },
        {
            "文件名": "main2.scpp(16~19)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "31",
            "拍数": 6014,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 2,
            "index": "31"
        }
    ],
    "main2.scpp(21~23)": [
        {
            "文件名": "main2.scpp(21~23)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "0",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "0"
        },
        {
            "文件名": "main2.scpp(21~23)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "1",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "1"
        },
        {
            "文件名": "main2.scpp(21~23)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "2",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "2"
        },
        {
            "文件名": "main2.scpp(21~23)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "3",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "3"
        },
        {
            "文件名": "main2.scpp(21~23)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "4",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "4"
        },
        {
            "文件名": "main2.scpp(21~23)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "5",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "5"
        },
        {
            "文件名": "main2.scpp(21~23)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "6",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "6"
        },
        {
            "文件名": "main2.scpp(21~23)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "7",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "7"
        },
        {
            "文件名": "main2.scpp(21~23)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "8",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "8"
        },
        {
            "文件名": "main2.scpp(21~23)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "9",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "9"
        },
        {
            "文件名": "main2.scpp(21~23)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "10",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "10"
        },
        {
            "文件名": "main2.scpp(21~23)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "11",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "11"
        },
        {
            "文件名": "main2.scpp(21~23)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "12",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "12"
        },
        {
            "文件名": "main2.scpp(21~23)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "13",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "13"
        },
        {
            "文件名": "main2.scpp(21~23)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "14",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "14"
        },
        {
            "文件名": "main2.scpp(21~23)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "15",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "15"
        },
        {
            "文件名": "main2.scpp(21~23)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "16",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "16"
        },
        {
            "文件名": "main2.scpp(21~23)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "17",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "17"
        },
        {
            "文件名": "main2.scpp(21~23)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "18",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "18"
        },
        {
            "文件名": "main2.scpp(21~23)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "19",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "19"
        },
        {
            "文件名": "main2.scpp(21~23)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "20",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "20"
        },
        {
            "文件名": "main2.scpp(21~23)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "21",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "21"
        },
        {
            "文件名": "main2.scpp(21~23)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "22",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "22"
        },
        {
            "文件名": "main2.scpp(21~23)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "23",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "23"
        },
        {
            "文件名": "main2.scpp(21~23)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "24",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "24"
        },
        {
            "文件名": "main2.scpp(21~23)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "25",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "25"
        },
        {
            "文件名": "main2.scpp(21~23)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "26",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "26"
        },
        {
            "文件名": "main2.scpp(21~23)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "27",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "27"
        },
        {
            "文件名": "main2.scpp(21~23)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "28",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "28"
        },
        {
            "文件名": "main2.scpp(21~23)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "29",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "29"
        },
        {
            "文件名": "main2.scpp(21~23)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "30",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "30"
        },
        {
            "文件名": "main2.scpp(21~23)",
            "函数名": "testB",
            "执行次数": 1,
            "线程号": "31",
            "拍数": 1,
            "指令缓存MISS次数": 0,
            "GLOBAL内存访问次数": 0,
            "index": "31"
        }
    ]
    }
    result_data.value.forEach(obj=>{
        let name = obj["文件名"];
        let all_data = all_result_data.value[name];
        // console.log(all_data);
        let length = all_data.length;
        let sum = 0;
        for (let it of all_data) {
            sum += it["拍数"];
        }
        obj["平均拍数"] = Math.round(sum / length);
    });
    
    dynamic_create_column();
}

let thread_data = ref([]);

window.addEventListener("message", e => {
    if (e.data["type"] == "show_result") {
        result_data.value = e.data["data"];
        all_result_data.value = e.data["all_data"];
        result_data.value.forEach(obj=>{
            let name = obj["文件名"];
            let all_data = all_result_data.value[name];
        // console.log(all_data);
            let length = all_data.length;
            let sum = 0;
            for (let it of all_data) {
                sum += it["拍数"];
            }
            obj["平均拍数"] = Math.round(sum / length);
        });
        dynamic_create_column();
    }
});

const init_style = (row) => {
    let index = row;
    if (index >= color_themes.length) {
        return {};
    }
    return {
        background: `linear-gradient(to right, ${color_themes[index].from}, ${color_themes[index].to})`,
        color: color_themes[index].color,
        width: '100%'
    }
}
const clickFunc = (row) => {
    window.vscode.postMessage({
        type: "click_item",
        data: JSON.stringify(row)
    })
}

const dynamic_create_column = () => {
    let keySet = new Set();
    result_data.value.forEach(item => {
        Object.keys(item).forEach(key => {
            if (key != "index" && key != '执行次数' && key != '文件名') {
                keySet.add(key);
            }
        });
    });
    columns.value = Array.from(keySet);
}
dynamic_create_column();
const onContextMenu = (row, e) => {

    e.preventDefault();
    ContextMenu.showContextMenu({
        x: e.x,
        y: e.y,
        theme: "mac dark",
        items: [
            {
                label: "查看所有从核数据",
                onClick: () => {
                    let tmp = all_result_data.value[row["文件名"]];
                    thread_data.value = tmp.map(it => {
                        const { 文件名, 函数名, ...rest } = it;
                        return rest;
                    });
                    let keySet = new Set();
                    thread_data.value.forEach(item => {
                        Object.keys(item).forEach(key => {
                            if (key != "index" && key != '执行次数') {
                                keySet.add(key);
                            }
                        });
                    });
                    thread_columns.value = Array.from(keySet);
                    show_details.value = !show_details.value;
                }
            }
        ]
    })
}
function demo_width(key) {
    if (key === '文件名' || key === '函数名' || key === '拍数' || key === '线程号' || key === '平均拍数') {
        return 100;
    }
    return 0;
}
</script>
<template>
    <div class="main_layout" v-if="result_data.length != 0">
        <!-- 测试打开 -->
        <!-- <el-button type="primary" @click="test_demo">ddddddddemo</el-button> -->
        <el-table :data="result_data" stripe style="width: 100%;" header-row-class-name="result_table_header"
            row-class-name="result_table_row" v-on:cell-click="clickFunc" v-if="!show_details" height="calc(100vh - 205px)"
            @row-contextmenu="(r, _, e) => onContextMenu(r, e)">
            <el-table-column fixed type="index" label="No." />
            <!-- :width="demo_width(key)" -->
            <el-table-column show-overflow-tooltip v-for="(key, i) in columns" :sortable="key == '拍数'" :key="i" :prop="key" :label="key" :width="demo_width(key)">
                <template #header>
                    <el-tooltip effect="dark" :content="key" placement="top">
                        <span>{{ key }}</span>
                    </el-tooltip>
                </template>
                <template v-slot:default=scope v-if="key == '拍数'">
                    <div style="display: flex; align-items: center">
                        <div :style="init_style(scope.row.index)">
                            {{ scope.row["拍数"] }}
                        </div>
                    </div>
                </template>
            </el-table-column>
        </el-table>

        <el-table v-else :data="thread_data" stripe style="width: 100%" header-row-class-name="result_table_header" height="calc(100vh - 205px)"
            row-class-name="result_table_row">
            <el-table-column fixed type="index" label="No." />
            <el-table-column show-overflow-tooltip v-for="(key, i) in thread_columns" :sortable="key == '拍数'" :key="i" :prop="key" :label="key" :width="demo_width(key)">
                <template v-slot:header>
                    <el-tooltip effect="dark" :content="key" placement="top">
                        <span>{{ key }}</span>
                    </el-tooltip>
                </template>
                <template v-slot:default=scope v-if="key == '拍数'">
                    <div style="display: flex; align-items: center">
                        <!-- scope.$index -->
                        <div :style="init_style(scope.row.index)">
                            {{ scope.row["拍数"] }}
                        </div>
                    </div>
                </template>
            </el-table-column>
        </el-table>
    </div>
</template>

<style scoped>
.main_layout {
    padding: 14px;
    height: 100%;
}

.el-table {
    background-color: var(--background-color);
}

:deep(.el-table th.el-table__cell > .cell) {
    white-space: nowrap;
}
:deep(.result_table_header th.el-table__cell) {
    background: var(--table-row-strip-color) !important;
    color: var(--table-row-color);
}

:deep(.result_table_row) {
    background: var(--background-color);
    color: var(--table-row-color);
}

:deep(.el-table td.el-table__cell) {
    border: none;
}

:deep(.el-table th.el-table__cell.is-leaf) {
    border: none;
}

:deep(.el-table__inner-wrapper::before) {
    height: 0;
}

:deep(.el-table tr:hover>td) {
    background: var(--table-row-hover-background-color) !important;
    color: var(--table-row-hover-color);
}

:deep(.el-table__row--striped.result_table_row td) {
    background-color: var(--table-row-strip-color) !important;
    color: var(--table-row-color);
}
</style>